package com.bizteco.ishark;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;


public class DBDAO {
	
	private String user = null;
	private String password = null;
	private String dbURL = null;
	private String driverName = null;
	
	private java.sql.Connection conn  = null;
	private java.sql.PreparedStatement pstmt = null;
	private java.sql.ResultSet rs = null;
	
	public DBDAO( String user, String password, String dbURL, String driverName ) {
		
		this.user = user;
		this.password = password;
		this.dbURL = dbURL;
		this.driverName = driverName;
		
	}
	
	public java.sql.Connection connect() throws SQLException, ClassNotFoundException {
		
//		Class.forName( this.driverName);
//		Class.forName( this.driverName, true, this.getClass().getClassLoader().getParent());	//x
//		Class.forName( this.driverName, true, ClassLoader.getSystemClassLoader());	//x
//		Class.forName( this.driverName, true, ClassLoader.getSystemClassLoader().getParent()); //x
//		Class.forName( this.driverName, true, this.getClass().getClassLoader());	//x
//		Class.forName( this.driverName, true, this.getClass().getClassLoader().getParent().getParent());	//x
		thi
		
		Properties dbProperties = new Properties();
		
		dbProperties.setProperty( "user", this.user);
		dbProperties.setProperty( "password", this.password);
		
		this.conn = DriverManager.getConnection( this.dbURL, dbProperties);
		
		return this.conn;
		
	}
	
	public void disconnect() throws SQLException {
		
		this.conn.close();
		
	}
	
}
